home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Resources
/
Chat & Communication
/
PeerAware 1.03
/
PeerAware-Setup.exe
/
Html
/
scripts
/
nczXMLDOMWrapper.js
< prev
next >
Wrap
Text File
|
2006-11-20
|
2KB
|
94 lines
var ARR_ACTIVEX=["MSXML4.DOMDocument","MSXML3.DOMDocument","MSXML2.DOMDocument","MSXML.DOMDocument","Microsoft.XmlDom"];
var STR_ACTIVEX="";
var isIE=navigator.userAgent.toLowerCase().indexOf("msie")>-1;
var isMoz=document.implementation&&document.implementation.createDocument;
if(isIE){
var bFound=false;
for(var i=0;i<ARR_ACTIVEX.length&&!bFound;i++){
try{
var objXML=new ActiveXObject(ARR_ACTIVEX[i]);
STR_ACTIVEX=ARR_ACTIVEX[i];
bFound=true;
}
catch(objException){
}
}
if(!bFound){
throw "No DOM DOcument found on your computer.";
}
}
if(isMoz){
Document.prototype.loadXML=function(_1){
changeReadyState(this,1);
var _2=new DOMParser();
var _3=_2.parseFromString(_1,"text/xml");
while(this.hasChildNodes()){
this.removeChild(this.lastChild);
}
for(var i=0;i<_3.childNodes.length;i++){
var _5=this.importNode(_3.childNodes[i],true);
this.appendChild(_5);
}
handleOnLoad(this);
};
Node.prototype.__defineGetter__("xml",_Node_getXML);
Document.prototype.readyState="0";
Document.prototype.__load__=Document.prototype.load;
Document.prototype.load=_Document_load;
Document.prototype.onreadystatechange=null;
Document.prototype.parseError=0;
}
function jsXML(){
}
jsXML.createDOMDocument=function(_6,_7){
var _8=null;
if(isMoz){
_8=document.implementation.createDocument(_6,_7,null);
_8.addEventListener("load",_Document_onload,false);
}else{
if(isIE){
_8=new ActiveXObject(STR_ACTIVEX);
if(_7){
if(_6){
_8.loadXML("<a0:"+_7+" xmlns:a0=\""+_6+"\" />");
}else{
_8.loadXML("<"+_7+"/>");
}
}
}
}
return _8;
};
function _Node_getXML(){
var _9=new XMLSerializer;
var _a=_9.serializeToString(this);
return _a;
}
function _Document_load(_b){
this.parseError=0;
changeReadyState(this,1);
try{
this.__load__(_b);
}
catch(objException){
this.parseError=-9999999;
changeReadyState(this,4);
}
}
function _Document_onload(){
handleOnLoad(this);
}
function handleOnLoad(_c){
if(!_c.documentElement||_c.documentElement.tagName=="parsererror"){
_c.parseError=-9999999;
}
changeReadyState(_c,4);
}
function changeReadyState(_d,_e){
_d.readyState=_e;
if(_d.onreadystatechange!=null&&typeof _d.onreadystatechange=="function"){
_d.onreadystatechange();
}
}